﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using LotteryAdmin.AdminService;
using System.Windows.Controls.Primitives;
using System.Threading;
using System.Windows.Threading;
namespace LotteryAdmin.Controls
{
    public partial class WatchHeader : UserControl
    {
        public WatchHeader()
        {
            InitializeComponent();
        }
        public bool isLoginPage
        {
            set
            {
                if (value)
                    this.sp_UserInfo.Visibility = Visibility.Collapsed;
                else
                    this.sp_UserInfo.Visibility = Visibility.Visible;
            }
            get
            {
                if (this.sp_UserInfo.Visibility == Visibility.Visible)
                    return false;
                else
                    return true;
            }
        }
        /// <summary>
        /// 系统标题名称
        /// </summary>
        public string Title
        {
            set 
            {
                this.tbkTitle.Text = value;
            }
            get
            {
                return this.tbkTitle.Text;
            }
        }

        /// <summary>
        /// 登录用户名
        /// </summary>
        public string LoginName
        {
            get
            {
                return this.txtUserName.Text;
            }
            set
            {
                this.txtUserName.Text = value;
            }
        }

        public string SubTitle
        {
            set
            {
                this.tbkSubTitle.Text = value;
            }
            get
            {
                return this.tbkSubTitle.Text;
            }
        }

        private void hybtnLogout_Click(object sender, RoutedEventArgs e)
        {
            OnLogout(this, e);
        }

        /// <summary>
        /// 注销事件
        /// </summary>
        public delegate void LogoutHandler(object sender, RoutedEventArgs e);
        public delegate void ChangePwdHandler(object sender, RoutedEventArgs e);

        public event LogoutHandler Logout;
        public event ChangePwdHandler ChangePwd;

        private void OnLogout(object sender, RoutedEventArgs e)
        {
            if (Logout != null)
            {
                Logout(this, e);
            }
        }
        private void OnChangePwd(object sender, RoutedEventArgs e)
        {
            if (ChangePwd != null)
            {
                ChangePwd(this, e);
            }
        }
        private void hybtnChangePwd_Click(object sender, RoutedEventArgs e)
        {
            OnChangePwd(this, e);
        }


    }
}
